<?php
// +----------------------------------------------------------------------
// | astp [ WE ONLY DO WHAT IS NECESSARY ]
// +----------------------------------------------------------------------
// | Author 荒年 < 931274989@qq.com >
// +----------------------------------------------------------------------
// | Explain 网站设置模块
// +----------------------------------------------------------------------
namespace app\base\controller;

use app\base\validate\WebConfig as WebConfigValidate;
use app\base\model\WebConfig as WebConfigModel;

class WebConfig extends Base
{
  public function index()
  {
    $model = new WebConfigModel();
    $web_config = $model->where('web','web')->find();
    $this->assign('web_config',$web_config);
    return $this->fetch();
  }

  public function edit()
  {
    if($this->request->isPost()) {
      (new WebConfigValidate)->goCheck();
      $post = $this->request->post();
      $model = new WebConfigModel();
      $result = $model->edit($post);
      if($result) {
        addLog();
        return $this->success('提交成功','base/WebConfig/index');
      } else {
        return $this->error('提交失败');
      }
    }
  }
}
